<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>作业21</title>
    <script>
        /*
        用户输入一个整数n，计算n的阶乘。即n*(n-1)*(n-2)*……*3*2*1.
        */

        var num = prompt("请输入一个整数");
        var mul = 1;

        for(var i=num; i>=1; i--){
            mul *= i;
        }

        alert("整数"+num+"的阶乘是："+mul);
    </script>
</head>
<body>
    
</body>
</html>